import { sleep } from 'antd-mobile/es/utils/sleep';
import axios from 'axios';

let pageNum = 0;
let pageSize = 4;
let data = [
  {
    introduce: '重工高雅婚纱',
    shop: '苏菲雅美学摄影1',
  },
  {
    introduce: '重工高雅婚纱',
    shop: '苏菲雅美学摄影2',
  },
  {
    introduce: '重工高雅婚纱',
    shop: '苏菲雅美学摄影3',
  },
  {
    introduce: '重工高雅婚纱',
    shop: '苏菲雅美学摄影4',
  },
  {
    introduce: '重工高雅婚纱',
    shop: '苏菲雅美学摄影5',
  },
  {
    introduce: '重工高雅婚纱',
    shop: '苏菲雅美学摄影6',
  },
  {
    introduce: '重工高雅婚纱',
    shop: '苏菲雅美学摄影7',
  },
];

export async function mockRequest() {
  if (pageNum * pageSize >= data.length) {
    await sleep(2000);
    return data.splice((pageNum - 1) * pageSize, pageNum * pageSize);
  } else {
    await sleep(2000);
    pageNum++;
    return data.splice((pageNum - 1) * pageSize, pageNum * pageSize);
  }
}
